﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;

namespace Demo.Classroom
{
    public partial class DemoGDI : Form
    {
        public DemoGDI()
        {
            InitializeComponent();

            this.SetStyle(ControlStyles.ResizeRedraw, true);
        }

        private void DemoGDI_Load(object sender, EventArgs e)
        {
            Color c = Color.FromArgb(100, 100, 0);
            //Brushes.AliceBlue
            //this.BackColor = Color.Tomato;
            //this.Font = new Font("Arial", 16, GraphicsUnit.Pixel);
        }

        private void DemoGDI_Paint(object sender, PaintEventArgs e)
        {
            using (Graphics graphic = this.CreateGraphics())
            {
                Pen p = new Pen(Color.Red, 10);
                p.StartCap = LineCap.Round;
                p.EndCap = LineCap.DiamondAnchor;
                graphic.DrawLine(p, new Point(10, 10), new Point(200, 200));
            }
        }

        private void invalidateButton_Click(object sender, EventArgs e)
        {
            this.Invalidate();
        }
    }
}
